package com.zsrt.java.day20161229.wrl.demo05;

public class Tank01 {
	
	public Tank01() {
//		System.out.println("无参构造器....");
	}
	
	public Tank01(String type, double weight, double money,double maxSpeed) {
//		System.out.println("有参构造器....");
		this.type = type;
		this.weight = weight;
		this.money = money;
		this.maxSpeed = maxSpeed;
	}
	
	private String type;
	private double weight;
	private double money;
	private double maxSpeed;
	
	@Override
	public String toString() {
		return type+"  [最大速度=" + maxSpeed + "马力  , 重量=" + weight + "顿  , 造价=" + money + "万]";
	}

	public String getBrand() {
		return type;
	}
	public void setBrand(String brand) {
		this.type = brand;
	}
	public double getWeight() {
		return weight;
	}
	public void setWeight(double weight) {
		this.weight = weight;
	}
	public double getMoney() {
		return money;
	}
	public void setMoney(double money) {
		this.money = money;
	}

	public double getMaxSpeed() {
		return maxSpeed;
	}

	public void setMaxSpeed(double maxSpeed) {
		this.maxSpeed = maxSpeed;
	}
	
	/**
	 * 发射导弹
	 * @param name	导弹类型
	 * @param distance	发射距离
	 * @return
	 */
	public boolean shoot(String name,int distance){
		if("飞毛腿导弹".equals(name)&&distance<=5000 || "爱国者导弹".equals(name)&&distance<=3000){
			return true;
		}
		return false;
	}


}
